using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Text;

namespace Data_Access_Tier
{
	public class HRM_TIMEKEEPERData : DatabaseObjectBase
	{
		public HRM_TIMEKEEPERData()
		{
			Initialize(true);
		}
		public HRM_TIMEKEEPERData(Boolean newConnection)
		{
			Initialize(newConnection);
		}

		public Int32 HRM_TIMEKEEPER_Insert(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date, String Symbol, DateTime TimeIn, DateTime TimeOut, Double Hour, Int32 LateMinute, Int32 EarlyMinute, Boolean IsOverTime, Boolean IsWork)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.InsertCommand = new SqlCommand("HRM_TIMEKEEPER_Insert");
				_dbadapter.InsertCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.InsertCommand.Connection = _dbconn;
				_trans = _dbconn.BeginTransaction();
				_dbadapter.InsertCommand.Transaction = _trans;
				_dbadapter.InsertCommand.Parameters.Clear();
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Symbol", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TimeIn", SqlDbType.DateTime));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TimeOut", SqlDbType.DateTime));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Hour", SqlDbType.Float));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LateMinute", SqlDbType.Int));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EarlyMinute", SqlDbType.Int));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsOverTime", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsWork", SqlDbType.Bit));
				_dbadapter.InsertCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.InsertCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.InsertCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.InsertCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.InsertCommand.Parameters["@Date"].Value = DateSQL;
				SqlString SymbolSQL = Symbol;
				_dbadapter.InsertCommand.Parameters["@Symbol"].Value = SymbolSQL;
				SqlDateTime TimeInSQL = SqlDateTime.Null;
				if (TimeIn > DateTime.MinValue)
				{
					try
					{
						TimeInSQL = TimeIn;
					}
					catch (Exception eTimeIn)
					{
						String TimeInMessage = eTimeIn.Message;
						TimeInSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.InsertCommand.Parameters["@TimeIn"].Value = TimeInSQL;
				SqlDateTime TimeOutSQL = SqlDateTime.Null;
				if (TimeOut > DateTime.MinValue)
				{
					try
					{
						TimeOutSQL = TimeOut;
					}
					catch (Exception eTimeOut)
					{
						String TimeOutMessage = eTimeOut.Message;
						TimeOutSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.InsertCommand.Parameters["@TimeOut"].Value = TimeOutSQL;
				SqlDouble HourSQL = Hour;
				_dbadapter.InsertCommand.Parameters["@Hour"].Value = HourSQL;
				SqlInt32 LateMinuteSQL = LateMinute;
				_dbadapter.InsertCommand.Parameters["@LateMinute"].Value = LateMinuteSQL;
				SqlInt32 EarlyMinuteSQL = EarlyMinute;
				_dbadapter.InsertCommand.Parameters["@EarlyMinute"].Value = EarlyMinuteSQL;
				SqlBoolean IsOverTimeSQL = IsOverTime;
				_dbadapter.InsertCommand.Parameters["@IsOverTime"].Value = IsOverTimeSQL;
				SqlBoolean IsWorkSQL = IsWork;
				_dbadapter.InsertCommand.Parameters["@IsWork"].Value = IsWorkSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.InsertCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_Insert: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Insert: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.InsertCommand != null)
					_dbadapter.InsertCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_Update(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date, String Symbol, DateTime TimeIn, DateTime TimeOut, Double Hour, Int32 LateMinute, Int32 EarlyMinute, Boolean IsOverTime, Boolean IsWork)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_Update");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Symbol", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeIn", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeOut", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Hour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LateMinute", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EarlyMinute", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsOverTime", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsWork", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@Date"].Value = DateSQL;
				SqlString SymbolSQL = Symbol;
				_dbadapter.UpdateCommand.Parameters["@Symbol"].Value = SymbolSQL;
				SqlDateTime TimeInSQL = SqlDateTime.Null;
				if (TimeIn > DateTime.MinValue)
				{
					try
					{
						TimeInSQL = TimeIn;
					}
					catch (Exception eTimeIn)
					{
						String TimeInMessage = eTimeIn.Message;
						TimeInSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TimeIn"].Value = TimeInSQL;
				SqlDateTime TimeOutSQL = SqlDateTime.Null;
				if (TimeOut > DateTime.MinValue)
				{
					try
					{
						TimeOutSQL = TimeOut;
					}
					catch (Exception eTimeOut)
					{
						String TimeOutMessage = eTimeOut.Message;
						TimeOutSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TimeOut"].Value = TimeOutSQL;
				SqlDouble HourSQL = Hour;
				_dbadapter.UpdateCommand.Parameters["@Hour"].Value = HourSQL;
				SqlInt32 LateMinuteSQL = LateMinute;
				_dbadapter.UpdateCommand.Parameters["@LateMinute"].Value = LateMinuteSQL;
				SqlInt32 EarlyMinuteSQL = EarlyMinute;
				_dbadapter.UpdateCommand.Parameters["@EarlyMinute"].Value = EarlyMinuteSQL;
				SqlBoolean IsOverTimeSQL = IsOverTime;
				_dbadapter.UpdateCommand.Parameters["@IsOverTime"].Value = IsOverTimeSQL;
				SqlBoolean IsWorkSQL = IsWork;
				_dbadapter.UpdateCommand.Parameters["@IsWork"].Value = IsWorkSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_Update: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Update: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_Disable(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date, ref Boolean Enabled)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_Disable");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@enabled", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@Date"].Value = DateSQL;
				_dbadapter.UpdateCommand.Parameters["@enabled"].Direction = ParameterDirection.Output;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_Disable: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Disable: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_Delete(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.DeleteCommand = new SqlCommand("HRM_TIMEKEEPER_Delete");
				_dbadapter.DeleteCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.DeleteCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.DeleteCommand.Transaction = _trans;

				_dbadapter.DeleteCommand.Parameters.Clear();
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.DeleteCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.DeleteCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.DeleteCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.DeleteCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.DeleteCommand.Parameters["@Date"].Value = DateSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.DeleteCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_Delete: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Delete: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.DeleteCommand != null)
					_dbadapter.DeleteCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_Save(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date, String Symbol, DateTime TimeIn, DateTime TimeOut, Double Hour, Int32 LateMinute, Int32 EarlyMinute, Boolean IsOverTime, Boolean IsWork)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_Save");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Symbol", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeIn", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeOut", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Hour", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LateMinute", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EarlyMinute", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsOverTime", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsWork", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@Date"].Value = DateSQL;
				SqlString SymbolSQL = Symbol;
				_dbadapter.UpdateCommand.Parameters["@Symbol"].Value = SymbolSQL;
				SqlDateTime TimeInSQL = SqlDateTime.Null;
				if (TimeIn > DateTime.MinValue)
				{
					try
					{
						TimeInSQL = TimeIn;
					}
					catch (Exception eTimeIn)
					{
						String TimeInMessage = eTimeIn.Message;
						TimeInSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TimeIn"].Value = TimeInSQL;
				SqlDateTime TimeOutSQL = SqlDateTime.Null;
				if (TimeOut > DateTime.MinValue)
				{
					try
					{
						TimeOutSQL = TimeOut;
					}
					catch (Exception eTimeOut)
					{
						String TimeOutMessage = eTimeOut.Message;
						TimeOutSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TimeOut"].Value = TimeOutSQL;
				SqlDouble HourSQL = Hour;
				_dbadapter.UpdateCommand.Parameters["@Hour"].Value = HourSQL;
				SqlInt32 LateMinuteSQL = LateMinute;
				_dbadapter.UpdateCommand.Parameters["@LateMinute"].Value = LateMinuteSQL;
				SqlInt32 EarlyMinuteSQL = EarlyMinute;
				_dbadapter.UpdateCommand.Parameters["@EarlyMinute"].Value = EarlyMinuteSQL;
				SqlBoolean IsOverTimeSQL = IsOverTime;
				_dbadapter.UpdateCommand.Parameters["@IsOverTime"].Value = IsOverTimeSQL;
				SqlBoolean IsWorkSQL = IsWork;
				_dbadapter.UpdateCommand.Parameters["@IsWork"].Value = IsWorkSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_Save: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Save: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_TIMEKEEPER_GetList()
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_TIMEKEEPER_GetList");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Prepare();
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_TIMEKEEPER_GetList: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_TIMEKEEPER_Get(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, DateTime Date)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_TIMEKEEPER_Get");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Date", SqlDbType.DateTime));
				_dbadapter.SelectCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.SelectCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.SelectCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.SelectCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlDateTime DateSQL = SqlDateTime.Null;
				if (Date > DateTime.MinValue)
				{
					try
					{
						DateSQL = Date;
					}
					catch (Exception eDate)
					{
						String DateMessage = eDate.Message;
						DateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.SelectCommand.Parameters["@Date"].Value = DateSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_TIMEKEEPER_Get: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_TIMEKEEPER_GetListByTimeKeeperTableListID(Guid TimeKeeperTableListID)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_TIMEKEEPER_GetListByTimeKeeperTableListID");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.SelectCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.SelectCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_TIMEKEEPER_GetListByTimeKeeperTableListID: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
	}
}
